<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- 提莫攻击 -->
    <script>
      var findPoisonedDuration = function (timeSeries, duration) {
        let len = timeSeries.length,
          timeCount = 0
        for (let i = 1; i < len; ++i) {
          let oneCount = timeSeries[i] - timeSeries[i - 1]
          if (oneCount >= duration) {
            timeCount += duration
          } else {
            timeCount += oneCount
          }
        }
        timeCount += duration
        return timeCount
      }
      console.log(findPoisonedDuration((timeSeries = [1, 4]), (duration = 2)))
    </script>
  </body>
</html>
